

<!DOCTYPE html>
<!-- Website template by freewebsitetemplates.com -->
<html>
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
		<title>Grade Bay</title>
		<link rel="stylesheet" href="gui.css" type="text/css" />
                <link rel="stylesheet" href="style.css" type="text/css" />
		<!--[if IE 7]>
			<link rel="stylesheet" href="css/ie7.css" type="text/css" />
		<![endif]-->
                
                <style>
                    .view{
                        text-decoration:none;
                        color:#878bbf;
                    }
                    
                    .view:hover{
                        color:#5d5d5d;
                    }
                    
                </style>
                <script>
                    function clearText(field)
                    {
                        if (field.defaultValue == field.value)
                            {
                                    field.value = '';
                                    field.style.color = '#000000';
                            }
                    }
                    
                    function checkIfEmpty(field)
                    {
                            if (field.value == '')
                                    bringBack(field);
                    }
                    
                    function bringBack(field)
                    {
                            field.type = 'text';
                            field.value = field.defaultValue;
                            field.style.color = '#A9A9A9';
                    }
                </script>
	</head>
	<body>
		<div class="page">
			<div class="header">
				<a href="index.php" id="logo"><img src="images/gradeBaylogo.png" width="330" height="79" alt=""/></a>
				<ul>
					<li><a href="index.php">HOME</a></li>
					<li ><a href="create.php">CREATE</a></li>
					<li class="selected"><a href="view.php">VIEW</a></li>
				</ul>
			</div>
			<div class="body">
                                
				<ul>
                                    <li><form name='searchForm' action='view.php' method='POST'>
                                            <input class='tf_effect' style='padding:0;color:#A9A9A9;' value='Search...' onclick="clearText(this)" onBlur="checkIfEmpty(this)" type='text' name='searchBar' />
                                            <select name='filter'>
                                                <option value='Subject'>Subject</option>
                                                <option value='Student'>Student</option>
                                                <option value='Teacher'>Teacher</option>
                                            </select>
                                            <input type="hidden" name="submitted" value="1">
                                            <?php
                     
                                            error_reporting(E_ALL ^ E_NOTICE);




                                            if ($_POST['submitted']==1)
                                            {
                                                include 'PHPClasses/DBAccess.php';
                                                
                                                echo "<table id=hor-minimalist-a>";
                                                
                                                if($_POST['filter']=='Student')
                                                {
                                                    include 'PHPClasses/StudentDBAccess.php';
                                                    $DBAccess = new StudentDBAccess();
                                                    
                                                    
                                                    $searchStudentQuery=$DBAccess->searchDB($_POST['searchBar']);
                                                    $countResultsQuery=$DBAccess->getCountInDB($_POST['searchBar']);

                                                        if($searchStudentQuery){
                                                            extract(mysql_fetch_array($countResultsQuery));
                                                            echo "<thead><tr><th>Student</th><th>$num result/s</th></tr></thead>";
                                                            while($row=mysql_fetch_array($searchStudentQuery))
                                                            {
                                                                extract($row);
                                                                echo "<tr><td><a href='viewStudentprofile.php?studentID=".$idStudent."' style='text-decoration:none; color:#636363;'>$studentName</td></tr>";
                                                            }

                                                        }
                                                    
                                                }
                                                
                                                
                                                else if($_POST['filter']=='Teacher')
                                                {
                                                            include 'PHPClasses/TeacherDBAccess.php';
                                                            $DBAccess = new TeacherDBAccess();
                                                            $searchTeacherQuery=$DBAccess->searchDB($_POST['searchBar']);
                                                            $countResultsQuery=$DBAccess->getCountInDB($_POST['searchBar']);

                                                            if($searchTeacherQuery)
                                                            {
                                                                    extract(mysql_fetch_array($countResultsQuery));
                                                                    echo "<thead><tr><th>Teacher</th><th>$num result/s</th></tr></thead>";

                                                                    while($row=mysql_fetch_array($searchTeacherQuery))
                                                                    {
                                                                        extract($row);
                                                                        if($teacherName!='NONE')
                                                                            echo "<tr><td><a href='editTeacher.php?teacherID=".$idTeacher."' style='text-decoration:none; color:#636363;'>$teacherName</td></tr>";

                                                                    }

                                                             }
                                                   
                                                }
                                                
                                                
                                                
                                                else
                                                {
                                                            include 'PHPClasses/SubjectDBAccess.php';
                                                            $DBAccess = new SubjectDBAccess();
                                                            $searchSubjectQuery=$DBAccess->searchDB($_POST['searchBar']);

                                                            $countResultsQuery=$DBAccess->getCountInDB($_POST['searchBar']);

                                                            if($searchSubjectQuery){
                                                                extract(mysql_fetch_array($countResultsQuery));
                                                                echo "<thead><tr><th>Subject</th><th>$num result/s</th></tr></thead>";
                                                                while($row=mysql_fetch_array($searchSubjectQuery))
                                                                {
                                                                    extract($row);
                                                                    echo "<tr><td><a href='editSubject.php?subjectID=".$idSubject."' style='text-decoration:none; color:#636363;'>$subjectName</td></tr>";
                                                                }

                                                            }
                                                   
    
                                              }
                                                
                                                
                                               echo "</table>";
                                            }
                                            ?>
                                    </li></form>
					<li>
					        <div class="featured">
							<img src="images/viewstud.jpg" width="255" height="265" alt=""/>
						</div>
                                            
						<div>
							<h3><a href="viewStudentList.php" class="view">View Students</a></h3>
							<p>View the students enrolled for the entire school year.</p>
						</div>
					</li>
					<li>
						 <div class="featured">
							<img src="images/viewsubj.jpg" width="210" height="265" alt=""/>
							
							
						</div>
						<div>
							<h3><a href="viewSubjects.php" class="view">View Subjects</a></h3>
							<p>View the subjects that the teachers will handle.</p>
						</div>
					</li>
					<li>
						 <div class="featured">
							<img src="images/viewteach.jpg" width="255" height="265" alt=""/>
							
							
						</div>
                                                
						<div>
							<h3><a href="viewTeachers.php" class="view">View Teachers</a></h3>
							<p>View the teachers that will be working and handling classes.</p>
						</div>
					</li>
					</ul>
				
			</div>
			<div class="footer">
				
				<p>&#169; Copyright &#169; 2011. Company name all rights reserved</p>
				<div class="connect">
					<a href=""><img src="images/paragox.png" width=160" height="110" alt=""/></a>
					<a href=""><img src="images/fblogo.png" width=120" height="100" alt="" style="position:relative; left:-31px"/></a>
					<a href=""><img src="images/harmony.png" width=120" height="100" alt="" style="position:relative; left:0px"/></a>
				</div>
			</div>
		</div>
	</body>
</html>  